Use dfdbmdpn.pkg
Use DataDict.pkg
Use dfSelLst.pkg
Use Windows.pkg

Use cDoctorDataDictionary.dd
Use cPatientDataDictionary.dd
Use cApptDataDictionary.dd

Object oAppt_Lkup is a dbModalPanel
    Set Label to "Appointments"
    Set Location to 42 13
    Set Size to 129 343

    Function Doctor_Name Returns String
      String sDoctor_Name
      Move ("Dr."* Doctor.First_Name* Doctor.Last_Name) to sDoctor_Name
      Function_Return sDoctor_Name
    End_Function //Doctor_Name

    Function Patient_Name Returns String
      String sPatient_Name
      Move (Patient.First_Name * Patient.Last_Name) to sPatient_Name
      Function_Return sPatient_Name
    End_Function //Patient_Name


    Object oDoctor_DD is a cDoctorDataDictionary
    End_Object    // oDoctor_DD

    Object oPatient_DD is a cPatientDataDictionary
    End_Object    // oPatient_DD

    Object oAppt_DD is a cApptDataDictionary
        Set DDO_Server to oPatient_DD
        Set DDO_Server to oDoctor_DD
    End_Object    // oAppt_DD

    Set Main_DD to oAppt_DD
    Set Server to oAppt_DD

    Object oSelList is a dbList
        Set Main_File to Appt.File_Number
        Set Ordering to 1
        Set Size to 103 332
        Set Location to 6 3

        Begin_Row
            Entry_Item Appt.Appt#
            Entry_Item Appt.Date
            Entry_Item (Doctor_name(Self))
            Entry_Item (Patient_Name(Self))
        End_Row

        Set Form_Width   item 0 to 48
        Set Header_Label item 0 to "Appt #"

        Set Form_Width   item 1 to 60
        Set Header_Label item 1 to "Date"

        Set Form_Width 2 to 102
        Set Header_Label item 2 to "Doctor"

        Set Form_Width 3 to 116
        Set Header_Label item 3 to "Patient"
        Set peAnchors to anAll
        Set peResizeColumn to rcAll
        Set Auto_Index_State to False

    End_Object    // oSelList

    Object oSearch_btn is a Button
        Set Label to "&Search..."
        Set Location to 112 5
        Set peAnchors to anBottomLeft

        Procedure OnClick
            Send Search To oSelList
        End_Procedure

    End_Object    // oSearch_btn

    Object oOK_btn is a Button
        Set Label to "O&K"
        Set Location to 112 233
        Set peAnchors to anBottomRight

        Procedure OnClick
            Send OK To oSelList
        End_Procedure

    End_Object    // oOK_btn

    Object oCancel_btn is a Button
        Set Label to "&Cancel"
        Set Location to 112 289
        Set peAnchors to anBottomRight

        Procedure OnClick
            Send Cancel To oSelList
        End_Procedure

    End_Object    // oCancel_btn

    On_Key Key_Alt+Key_K Send KeyAction To oOk_btn
    On_Key Key_Alt+Key_C Send KeyAction To oCancel_btn
    On_Key Key_Alt+Key_S Send KeyAction To oSearch_btn

End_Object    // oAppt_Lkup

